package com.wht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wht.domain.DtsOrder;
import com.wht.mapper.DtsOrderMapper;
import com.wht.mapper.StatMapper;
import com.wht.service.DtsOrderService;
import com.wht.vo.CategorySellAmts;
import com.wht.vo.DayStatis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wanghaotian
 * time:2022/12/05,0005 11:01
 * description:
 */

@Service
public class DtsOrderServiceImpl implements DtsOrderService {

    @Autowired
    private DtsOrderMapper orderMapper;

    @Autowired
    private StatMapper statMapper;

    @Override
    public int count() {
        QueryWrapper<DtsOrder> wrapper = new QueryWrapper<>();
        wrapper.eq("deleted", false);
        Integer count = orderMapper.selectCount(wrapper);
        return count;
    }

    @Override
    public List<DayStatis> recentCount(int statisDaysRang) {
        return statMapper.statisIncreaseOrderCnt(statisDaysRang);
    }

    @Override
    public List<CategorySellAmts> cateGorySell() {
        return statMapper.categorySellStatis();
    }
}
